package com.xm.share.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xm.share.mapper.CommentMapper;
import com.xm.share.mapper.PictureshareMapper;
import com.xm.share.model.Comment;
import com.xm.share.service.CommentService;

/**
 * Created by Administrator on 2016/5/29.
 */
@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentMapper commentMapper;
    
    @Autowired
    private PictureshareMapper pictureshareMapper;

    @Override
    public void addComment(Comment comment) throws Exception {
        commentMapper.insert(comment);
        //评论加1
        pictureshareMapper.updateCommentNum(comment.getPictureShareId());
    }

    @Override
    public void delComment(Long commentId) throws Exception {
        commentMapper.deleteByPrimaryKey(commentId);
    }
}
